// TOWN DIALOGUE SCRIPT
//    Town 25: Tower of Magi

begintalkscript;

variables;

short i,j,k,r1,choice;

// Linda

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Linda";
	text1 = "You meet the shredded wreckage of a human being. She has grievous wounds on her arms and chest, but one look in her eyes tell you that the worst damage is in her mind.";
	text2 = "Her voice scrapes its way out of her throat. _Ah. Hello. I was Linda._";
	text5 = "Linda looks up at you, dazed. She somehow manages to cling to life. Her eyes are empty.";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_You are hurt! Is there any way I can heal you?_";
	text1 = "_I am ... I am beyond help. My spirit was torn away. Only magic keeps me alive. Portal. You must destroy portal._";

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_What happened to you?_";
	text1 = "She digs her torn fingernails into her legs and speaks. _I. Failed. I brought destruction on us all._";

begintalknode;
	state = 2;
	nextstate = 3;
	question = "_What did you do?_";
	text1 = "She inhales, slowly and painfully, and speaks. _I brought demons here. I thought I could bend Grah-Hoth to my will. Using my own spirit. As the gate._";

begintalknode;
	state = 3;
	nextstate = -1;
	question = "_Is Grah-Hoth here?_";
	text1 = "_Not... not yet. The demons hold the portal open. He tries to find way through. Portal must be destroyed._";

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_Grah-Hoth. Who is he?_";
	text1 = "Her face twists in horror. _Avernum's great foe. Defeated by warriors in years past. Still there. Still able to serve us._";
	text2 = "_I wanted to bend Avernum's great foe to our will. To use against the Empire. I would channel him here. Through me. I would hold his demon legions back. With my own spirit._";

begintalknode;
	state = 4;
	nextstate = 5;
	question = "_Your spirit could not hold them back?_";
	text1 = "She screams, a long, wrenching keen. Her chest heaves, which, considering the extent of the burns on her chest, must be agonizing. _They used me as a gate. Ripped my soul. Away! I am their gate!_";
	text2 = "She quiets down. _My spirit has been taken. From me. Made into a gate. Through which demons will pour into Avernum._";

begintalknode;
	state = 5;
	nextstate = 6;
	question = "_How can we close your soul gate?_";
	text1 = "She starts to lose consciousness, but manages to pull back from oblivion. _It must be torn. It must be destroyed. It is the only way to save us all. It can be severed. If you have the blessed athame._";
	text2 = "_There is little other help I can give._";

begintalknode;
	state = 6;
	nextstate = 7;
	condition = has_spec_item(36) == 0;
	question = "_Where can I get this blessed athame?_";
	text1 = "_I managed to put it in the temple. It will be safe there, but not for long. Then go to the portal. At the highest point of the tower. Don't hesitate to destroy it. Or we are all doomed._";

begintalknode;
	state = 7;
	nextstate = -1;
	question = "_Where is the temple?_";
	text1 = "_To the north and east. The demons cannot approach the altar. Get athame. Then return. Can say more. Go._";
	action = END_TALK;
	
begintalknode;
	state = 6;
	nextstate = 8;
	condition = has_spec_item(36) > 0;
	question = "_I got the athame. Now what?_";
	text1 = "She starts barking out what she knows. _Do not go to the portal by the main route. Grah-Hoth's forces are there! If you can find my laboratory. Things that will help! And some spirits can give information!_";

begintalknode;
	state = 8;
	nextstate = -1;
	question = "_Which way is the main route?_";
	text1 = "_From the main gate. The north end of the tower, up the stairs, along the walkway. That way leads to the portal. And demons. Many. Many demons. Stay back._";

begintalknode;
	state = 8;
	nextstate = -1;
	question = "_Where are the spirits you mentioned?_";
	text1 = "The effort of speaking is clearly agonizing for her, but she continues. _I have seen some of the spirits. Those the demons slew. They're nearby. I don't know why they stayed. They must have a reason!_";
	text2 = "_Speak to them, if you can._";

begintalknode;
	state = 8;
	nextstate = -1;
	question = "_Where is your laboratory?_";
	text1 = "_In the second tier. Climb the stairs at the south end of the tower. To the west from there. Go. Save us._";
	action = END_TALK;

begintalknode;
	state = 8;
	nextstate = -1;
	question = "_What kind of help is in your laboratory?_";
	text1 = "_I had a ... a ... secret way. Secret way to the portal. Read my notes._";

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_You are Linda! You are responsible for this destruction! You must die!_ (Kill her.)";
	text1 = "She is powerless to defend herself. You slay her easily.";
	action = END_TALK;
	code =
		erase_char(2505);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	question = "_That is all I need._ (Leave.)";
	text1 = "As you walk off, she mutters, _So lost. So lost._";
	action = END_TALK;

// Solberg

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Solberg";
	text1 = "This wizard's torn and scorched robes mark him as a member of the Triad of the Tower of Magi. He has been badly burned, but he still looks thrilled to see you.";
	text2 = "He tries to blink the soot out of his eyes. He can barely see you. _Reinforcements! I am Solberg. Thank Heavens help has come!_";
	text5 = "Solberg continues to cower back here out of the way. _Thank Heavens you are here! You must help us._";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_What has happened here?_";
	text1 = "He waves his hand at the cracked and burnt walls. _It was Linda! She tried again to summon and control the dark powers, and now we may all be doomed!_";

begintalknode;
	state = 30;
	nextstate = 31;
	question = "_Is Linda still alive?_";
	text1 = "_She is, curse her!_ He can barely contain his anger. _Damn her to the pit forever! You cannot imagine the horror that has been wrought here! If you cannot help us contain the dark powers, we may all be doomed!_";
	text2 = "He calms down a little. _Still, if you could speak to her, she might be able to tell you what she did. She survived the demon's attack._";

begintalknode;
	state = 30;
	nextstate = 32;
	question = "_What dark powers did she summon?_";
	text1 = "_Years ago, we finally banished the demon lord Grah-Hoth from our caves. Now she has made it possible for him to return! There is a gate at the top of the tower, through which even now he is trying to force himself._";

begintalknode;
	state = 31;
	nextstate = 32;
	question = "_Why are we doomed?_";
	text1 = "_Linda commandeered our portal, at the top of the Tower, and Grah-Hoth is trying to work his way through. The gate must be destroyed!_";

begintalknode;
	state = 32;
	nextstate = -1;
	question = "_Who is Grah-Hoth?_";
	text1 = "_One of the most powerful demons that ever existed. It was only through great luck and cost that he was banished before. This time, he is prepared. He must be kept away!_";

begintalknode;
	state = 32;
	nextstate = 33;
	question = "_How can I destroy the gate?_";
	text1 = "_That is the problem! I don't know how to close the gate. I can sense it from here. It is powerful in a way I am completely unfamiliar with! Explore the Tower as best you can. Maybe you will find a clue for how to deal with it. Linda might know._";
	text2 = "_But before you go, a warning!_";

begintalknode;
	state = 33;
	nextstate = -1;
	question = "_Did you see where Linda went?_";
	text1 = "_I saw her running to the southeast. I hope she survives this ordeal, if only so I can punish her myself! If she lives, she may be hiding there._";

begintalknode;
	state = 33;
	nextstate = -1;
	question = "_What is your warning?_";
	text1 = "_The path up to the portal is guarded by the bulk of Grah-Hoth's forces. Avoid them, or you may well be overwhelmed._";

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_You are hurt. Can I help you?_";
	text1 = "_Save your energy. You will need it to seal the portal. You are our only hope._";

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_Can you give me any help or training?_";
	text1 = "He looks annoyed by the question. He is clearly in too much pain to help you.";

begintalknode;
	state = 32;
	nextstate = 35;
	question = "_How can I get up to the portal?_";
	text1 = "_I don't know. The main route is guarded by a demon horde. If there is a second route up, I don't know where it is. I can give you some useful knowledge, though._";

begintalknode;
	state = 35;
	nextstate = -1;
	question = "_What?_";
	text1 = "_I have been exploring the tower. It has been difficult to evade the demons, but I have managed. I know that most of their guards are at the north end of the tower, near the entrance. There are fewer demons to the south and east._";

begintalknode;
	state = 29;
	nextstate = 34;
	question = "_Did anyone else survive the demon attacks?_";
	text1 = "_We received no warning. She did something in her lab, and the creatures poured forth. Hardly anyone survived. The Triad is sundered. I hid myself here magically. That is the only reason I am still alive._";

begintalknode;
	state = 34;
	nextstate = -1;
	question = "_What happened to the other Triad members?_";
	text1 = "_I felt Mahdavi's death. X teleported away. I am stuck here. Together, we might have been able to do something, but the demons came without warning._";

// Ghost of Bernard

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Ghost of Bernard";
	text1 = "The spirit of a young man floats here, over the charred bones of an apprentice mage. It stares at you. _I was Bernard._";
	text5 = "Bernard's ghost stares at you.";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_Why are you here, spirit?_";
	text1 = "_Oh, you must help me. Help me if you can! I need to save Carrie!_";

begintalknode;
	state = 58;
	nextstate = 60;
	question = "_How can I help you?_";
	text1 = "_Surely you can bring her back! I was under the silence oath all the time, and could never tell her how I felt about her! Bring her to me?_";

begintalknode;
	state = 58;
	nextstate = 59;
	question = "_What happened to Carrie?_";
	text1 = "_I saw them get her! They seized her and dragged her off._ He moans. _I ran! They were so horrifying! They trapped me here. She must have lived! I will still save her!_";

begintalknode;
	state = 59;
	nextstate = 61;
	question = "_I'm sorry, but I think she is beyond saving._";
	text1 = "_I can! I will! Help me? Please? I can't rest till she knows how much I loved her._";

begintalknode;
	state = 60;
	nextstate = 61;
	question = "_Why were you under a silence oath?_";
	text1 = "_They made me take an oath to be silent before I could be an apprentice! Never could I say a word to her. I had to tell her I loved her in other ways._";
	text2 = "_Oh, please, help me say the words to her._";

begintalknode;
	state = 61;
	nextstate = -1;
	question = "_If I encounter Carrie I will try to convey your words._";
	text1 = "_I want to tell her I love her. Help me?_ He wavers and floats away.";
	action = END_TALK;

// Ghost of Conruc

begintalknode;
	tag = 100;
	state = -1;
	nextstate = 85;
	question = "Ghost of Conruc";
	text1 = "You encounter the insubstantial form of a middle-aged man, still wearing translucent robes and a sash of office. He motions you forward. _Ah,_ it says. _The living. I was Conruc. There was not much time._";
	text5 = "_I still was Conruc. I still have much to say to whoever will listen._";
	action = INTRO;

begintalknode;
	state = 85;
	nextstate = 86;
	question = "_Why are you here, spirit?_";
	text1 = "_Hurry! I was useless in life! Don't let me be useless in death, too!_";

begintalknode;
	state = 86;
	nextstate = 87;
	question = "_How were you useless in life?_";
	text1 = "He points at the spectral sash of office. _This was a sign of my uselessness! I could do nothing as a bureaucrat. When the demons came, I saw my chance!_";

begintalknode;
	state = 87;
	nextstate = -1;
	question = "_Were you mayor here?_";
	text1 = "_I was the administrator for the Tower of Magi. I had no powers, no responsibilities. Then I had a chance to fight the demons. I failed._";

begintalknode;
	state = 87;
	nextstate = 88;
	question = "_What chance did you see?_";
	text1 = "_They have a gate, and they're trying to bring more demons through. I tried to close it._";

begintalknode;
	state = 88;
	nextstate = 89;
	question = "_How did you try to close it?_";
	text1 = "_The main way to it was well-guarded, but I think there is a back entrance!_";

begintalknode;
	state = 89;
	nextstate = 89;
	question = "_What is the main entrance?_";
	text1 = "_The main entrance is up the stairs by the main entrance by the tower, but there are huge demons there. But I know the tower so well, I was able to find a back entrance!_";

begintalknode;
	state = 89;
	nextstate = 90;
	question = "_What back entrance?_";
	text1 = "_There is a secret passage from Linda's laboratory to the portal. I opened it. But I can't remember how. I got killed, and it took away memories. It was something about ... Antler. Turn an antler. That is all I know._";
	code =
		sf(25,12,1);
	break;
	
begintalknode;
	state = 90;
	nextstate = -1;
	question = "_Where is Linda?_";
	text1 = "_She is close. I can sense her. Quite close._";

begintalknode;
	state = 90;
	nextstate = 91;
	question = "_Did you get to the portal?_";
	text1 = "_Then a demon surprised me. It sucked away my energy, picked me up, and gutted me. Oh, how it hurt!_ He winces at the memory. _I failed to reach the gate. Now you must try! Otherwise, you are all doomed._";

begintalknode;
	state = 91;
	nextstate = -1;
	question = "_How can you be so sure of that?_";
	text1 = "_You can't feel it. You're not spirits. But I can! An evil force of incredible power is coming! I wouldn't want to be you if you don't shut that portal soon. Go. Go!_";
	action = END_TALK;
	
// Ghost

begintalknode;
	tag = 120;
	state = -1;
	nextstate = 113;
	question = "Ghost";
	text1 = "You find a wispy and insubstantial ghost, huddled in a corner. You ask its name. It whispers, _I'm dead._";
	text5 = "The ghost looks up at you. _I'm dead._";
	action = INTRO;

begintalknode;
	state = 113;
	nextstate = 114;
	question = "_Why are you here, spirit?_";
	text1 = "_I'm dead. Before I move on, I have a purpose._";

begintalknode;
	state = 114;
	nextstate = 115;
	question = "_How did you die?_";
	text1 = "_Some imps used me as a plaything. I wish not to speak of it. It is not part of my purpose._";

begintalknode;
	state = 115;
	nextstate = 116;
	question = "_What is your purpose?_";
	text1 = "The ghost's voice is flat and emotionless. _There is something I am being held here to teach you. A spell._";

begintalknode;
	state = 116;
	nextstate = -1;
	question = "_Who is holding you here?_";
	text1 = "_I don't know who holds me here. Maybe it's me. Does it matter?_";

begintalknode;
	state = 116;
	nextstate = -1;
	question = "_Go ahead and teach me the spell._";
	text1 = "The shade fades away.";
	action = END_TALK;
	code =
		run_hardcode(122);
	break;

